var windowName = "userSignSum";
var Page;
apiready = function(){
    onWindowShow(function () {
        console.log(windowName + " show")
    })
    onWindowHide(function () {
        console.log(windowName + " hide")
    })
    console.log("index page is OK");
    Page = createVM("#Page",{
        //页面数据
        type:"in",
        month:0,
        singIn:0,
        out:0,
        day:0,
        list:{"20190501":{"num":"01","in":0,"out":0},"20190502":{"num":"02","in":0,"out":0},"20190503":{"num":"03","in":0,"out":0},"20190504":{"num":"04","in":0,"out":0},"20190505":{"num":"05","in":0,"out":0},"20190506":{"num":"06","in":0,"out":0},"20190507":{"num":"07","in":0,"out":0},"20190508":{"num":"08","in":0,"out":0},"20190509":{"num":"09","in":0,"out":0},"20190510":{"num":10,"in":0,"out":0},"20190511":{"num":11,"in":0,"out":0},"20190512":{"num":12,"in":0,"out":0},"20190513":{"num":13,"in":0,"out":0},"20190514":{"num":14,"in":0,"out":0},"20190515":{"num":15,"in":0,"out":0},"20190516":{"num":16,"in":0,"out":0},"20190517":{"num":17,"in":0,"out":0},"20190518":{"num":18,"in":0,"out":0},"20190519":{"num":19,"in":0,"out":0},"20190520":{"num":20,"in":0,"out":0},"20190521":{"num":21,"in":0,"out":0},"20190522":{"num":22,"in":0,"out":0},"20190523":{"num":23,"in":0,"out":0},"20190524":{"num":24,"in":0,"out":0},"20190525":{"num":25,"in":0,"out":0},"20190526":{"num":26,"in":0,"out":0},"20190527":{"num":27,"in":0,"out":0},"20190528":{"num":28,"in":0,"out":0},"20190529":{"num":29,"in":0,"out":0},"20190530":{"num":30,"in":0,"out":0},"20190531":{"num":31,"in":0,"out":0}},
        show:"-"
    },{
        //页面方法
        "init":function () {
            var pageData = getData4Page(windowName);
            this.type = pageData.type;
            getData(this)
        },
        last:function () {
            ++this.month
            getData(this)
        },
        next:function () {
            --this.month
            getData(this)
        },
        OnPullDownRefresh:function () {
            this.month = 0;
            getData(this)
        }
    })
    Page.init()

}

function getData(_this) {
    startPullDownRefresh()
    apiGet("/app/sign/sum",{m:_this.month},function (res) {
        stopPullDownRefresh();
        _this.show = res.data.month
        _this.list = res.data.list
        _this.singIn = res.data.in
        _this.out = res.data.out
        _this.day = res.data.day
        _this.day = res.data.day
    })
}